from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

from common.Utils import QuestDriver



class QuestEdit():
    url = ""
    driver = ""

    def __init__(self,url):
       self.url = url
       self.driver = QuestDriver.driver
       self.driver.get(self.url)

    def OverView(self):
        wait = WebDriverWait(self.driver,10)

        #点击切换到概述页面
        wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR,".actions-container div:nth-child(1) button"))).click()
        text = wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR,"div:nth-child(1) > div.header > span > span"))).text.strip()
        assert text == "日收集问卷"

        #问卷开启
        wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR,"div.ant-row > div > div > div:nth-child(2) > div:nth-child(2) > button"))).click()


